package com.gmom.tako;


import com.gmom.tako.model.Rss;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class Detail extends Activity {
	private Rss rss;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.detail);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		//インテントからIDを取得
		Bundle extras = getIntent().getExtras();
		 Rss rss = (Rss)extras.getSerializable(MainActivity.INTENT_RSS);
		 this.rss = rss;
		 //title
		 TextView textTitle = (TextView)findViewById(R.id.text_title);
		 if(textTitle != null) {
			 textTitle.setText(rss.getTitle().toString());
		 }
		 //detail
		 TextView textDetail = (TextView)findViewById(R.id.text_detail);
		 if(textDetail != null) {
			 //Log.v("detailactivity", "getDate:" + rss.getDate());
			 textDetail.setText(rss.getDetail().toString());
		 }
		 //date
		 TextView textDate = (TextView)findViewById(R.id.text_date);
		 if (textDate != null) {
			textDate.setText(rss.getDate().toString());
		}
		
	}
	
	public void onClickOpenUrl(View v) {
		if (rss!=null) {
			Intent bi = new Intent(Intent.ACTION_VIEW, Uri.parse(rss.getLink()));  
			startActivity(bi);
		}
	}
	
}
